package com.sinoglobal.ningxia.gsyvideoplayer;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;
import com.sinoglobal.ningxia.R;

/**
 * Created by XINDZ on 2017/5/4.
 * 功能:
 */

public class LiveGSYVideoPlayer extends StandardGSYVideoPlayer {
    public LiveGSYVideoPlayer(Context context, Boolean fullFlag) {
        super(context, fullFlag);
    }

    public LiveGSYVideoPlayer(Context context) {
        super(context);
    }

    public LiveGSYVideoPlayer(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onTouch(View v, MotionEvent event) {
        int duration = getDuration();
        if (duration > 0) {

            return super.onTouch(v, event);
        } else {
            int id = v.getId();
            if (id == R.id.surface_container) {
                switch (event.getAction()) {
                    case MotionEvent.ACTION_DOWN:
                        break;
                    case MotionEvent.ACTION_MOVE:
                        break;
                    case MotionEvent.ACTION_UP:
                        if (mChangePosition) {
                            return true;
                        }
                        if (!mChangePosition && !mChangeVolume && !mBrightness) {
                            onClickUiToggle();
                        }
                        break;
                }
            } else if (id == R.id.progress) {
                return true;
            }

            if (mIfCurrentIsFullscreen && mLockCurScreen && mNeedLockFull) {
                return true;
            }
            return true;
        }
    }
}
